import React from 'react'
import ReactDOM from 'react-dom'

var MyComponent = React.createClass({
    handleClick: function () {
        this.refs.myInput.focus()
    },
    render: function () {
        return(
            <div>
                <input type="text" ref="myInput"/>
                <input type="button" value="输入框获取焦点" onClick={this.handleClick}/>
            </div>
        )
    }
})

ReactDOM.render(
    <MyComponent/>,
    document.getElementById('app')
)